extends Node3D
class_name Main04

var s_cube: PackedScene = preload("res://04hello_godot/cube.tscn")

var add_property := 3
var my_property: int = 0: get = _my_property_getter, set = _my_property_setter
#	get:
#		print("my_property：", my_property)
#		return my_property + add_property
#	set(value):
#		print("赋值之前：", my_property)
#		my_property = clamp(value, 0, 5)
#		print("赋值之后：", my_property)

# var p3 :int = 0 setget _, _p3_getter

func _my_property_getter() -> int:
	print("my_property：", my_property)
	return my_property + add_property

func _my_property_setter(value:int) -> void:
	print("赋值之前：", my_property)
	my_property = clamp(value, 0, 5)
	print("赋值之后：", my_property)	

func _ready() -> void:
	my_property = 10
	print('Hello Godot! ', my_property)
	add_child(s_cube.instantiate())

func _process(delta: float) -> void:
#	add_child(s_cube.instantiate())
	pass

var testArray : PackedStringArray = ['asda', 123]

func greet(name):
	print("Hello, " + name + "!")
